using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Sis.Entities;

namespace Sis.Repository.Mapping
{
    public class CuotaIslaMap : EntityTypeConfiguration<CuotaIsla>
    {
        public CuotaIslaMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Ubigeo)
                .IsRequired()
                .HasMaxLength(500);

            // Table & Column Mappings
            this.ToTable("CuotaIsla");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Ubigeo).HasColumnName("Ubigeo");
            this.Property(t => t.IdIslaVenta).HasColumnName("IdIslaVenta");
            this.Property(t => t.NGestores).HasColumnName("NGestores");
            this.Property(t => t.FechaIniCuota).HasColumnName("FechaIniCuota");
            this.Property(t => t.FechaFinCuota).HasColumnName("FechaFinCuota");
            this.Property(t => t.NPostTotal).HasColumnName("NPostTotal");
            this.Property(t => t.NPortaTotal).HasColumnName("NPortaTotal");
            this.Property(t => t.NPreTotal).HasColumnName("NPreTotal");
            this.Property(t => t.NChipTotal).HasColumnName("NChipTotal");

            // Relationships
            this.HasRequired(t => t.IslaVenta)
                .WithMany(t => t.CuotaIslas)
                .HasForeignKey(d => d.IdIslaVenta);

        }
    }
}
